package com.xlh.dao.courseTest;

import com.xlh.dto.courseTest.*;
import com.xlh.pojo.courseTest.CourseTestPaper;
import com.xlh.pojo.courseTest.CourseTestPaperAnswerSheet;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author zhr 2019/2/21
 */
public interface CourseTestPaperAnswerSheetMapperExt {
    List<PaperListDataDTO> selectStudentPaperList(@Param("userId") Long userId, @Param("courseId") Long courseId);

    List<AnswerSheetListDTO> selectStudentList(@Param("userInfo") String userInfo, @Param("paperId") Long paperId);

    Long selectMaxId();

    void insertBatch(List<CourseTestPaperAnswerSheet> list);

    CourseTestPaperAnswerSheet selectByPaperIdAndStudentId(@Param("paperId") Long paperId, @Param("userId") Long userId);

    void cleanData();

    List<PaperAnswerSheetDTO> selectByCourseIdWithoutBLOBs(@Param("courseId") Long courseId, @Param("stat") Integer stat);

    List<ClassCheckCountDTO> getClassCheckCount(@Param("classIds") List<Long> classIds, @Param("courseId") Long courseId);

    List<ClassCheckCountDTO> getClassCheckCountOther(@Param("classIds") List<Long> classIds, @Param("courseId") Long courseId);

    void updateSelectiveBatch(List<CourseTestPaperAnswerSheet> answerSheetList);

    /**
     * 只获取指定试卷状态的学生得分情况
     * @param courseId 课程id
     * @param userId 用户id
     * @param paperStat 试卷状态
     * @return 指定状态指定课程的学生考试成绩情况
     */
    List<CourseTestPaper> listStudentExam(@Param("courseId") Long courseId, @Param("userId") Long userId, @Param("status") Integer paperStat);

    /**
     * 查询实验题学生的参加情况
     */
    List<CourseTestPaperAnswerSheet> selectExperiment(@Param("paperId") Long paperId);

    long countByUserIdsCourseId(@Param("userIds") List<Long> userIds, @Param("courseId") Long courseId);

    long countByUserIdsCourseIds(@Param("userIds") List<Long> userIds, @Param("courseId") List<Long> courseIds);

    List<Long> getTestingCourse(@Param("classIds") List<Long> classIds);

    List<ClassCheckCountDTO> selectUncheckedByCourseIds(@Param("courseIdList") List<Long> courseIdList);

    List<UserCourseTestInfoDTO> findTestStatsticsByUserIds( @Param("courseId") Long courseId, @Param("classId") Long classId,
                                                            @Param("userIds") List<Long> userIds, @Param("stat") Integer stat);
}
